package com.jt.tenant.dialog;

import android.content.Context;
import android.view.Gravity;
import android.view.View;

import com.jt.tenant.picker.TimePopupWindow;

import java.util.Date;

/**
 * Created by Administrator on 2016/4/28.
 */
public abstract class MyTimePopup extends TimePopupWindow {

    private Date currentDate;

    public MyTimePopup(Context context, Date start, Date end, Type yearMonthDay) {

        super(context, start, end, yearMonthDay);

        setOnTimeSelectListener(new OnTimeSelectListener() {

            @Override
            public void onTimeSelect(Date date) {

                currentDate = date;

            }

        });

    }

    @Override
    public void onClick(View v) {

        super.onClick(v);

        if (((String)v.getTag()).equals("submit")){

            onSubmit(currentDate);

        }

    }

    public void show(View view){

        showAtLocation(view, Gravity.BOTTOM, 0, 0);

    }

    public abstract void onSubmit(Date date);

}
